// TOWN DIALOGUE SCRIPT
//    Town 124: Silvar

begintalkscript;

variables;

short i,j,k,r1,choice;

begintalknode;
	tag = 1;
	text1 = "Aaah!";
	text2 = "Get out!";
	action = SPEECH_BUBBLE;
	code =
		cs();
		as(get_ran(1,1,2));
	break;


// Kelda

begintalknode;
	tag = 40;
	state = -1;
	nextstate = 1;
	question = "Kelda";
	text1 = "The innkeeper is a rotund woman with long dark hair. She is reading a book when you approach the bar. You have to clear your throat to get her attention. _I'm Kelda. Welcome to my inn._";
	text5 = "Kelda looks longingly at her book. _Need anything? I kinda want to get back to what I was reading._";
	action = INTRO;

begintalknode;
	state = 1;
	nextstate = 2;
	question = "_How fares this place?_";
	text1 = "_Not too well. Not much business, what with all the slimes. I'll give you a good room for only three coins, and wine for one. Best prices in the province._";


begintalknode;
	state = 2;
	nextstate = 3;
	question = "_Have the slimes been a real bother?_";
	text1 = "_Ever since the slimes started appearing, it's been nothing but constant attacks. Oh well. At least we didn't end up like Colchis._";
	text3 = "_The slimes have been tearing our town apart. There are plenty of destroyed buildings to testify to it._ She shakes her head, concerned. _Oh well. At least we haven't ended up like Colchis._";
	code =
		if (day_reached(50,0))
			remove_string(1);
			else remove_string(3);
	break;

begintalknode;
	state = 3;
	nextstate = 4;
	question = "_I'm afraid to ask, but what happened to Colchis?_";
	text1 = "_The poor village was only twenty miles to the east. I say 'was.' They were hit by even more slime attacks than us. Constant. The humans abandoned the place, and the slimes took over. Nothing but ruins there now._";

begintalknode;
	state = 4;
	nextstate = 5;
	question = "_Why did Colchis get more slime attacks?_";
	text1 = "_Not sure. Nobody knows why they got more attacked than us. One thing I've heard, though. The farther west from here you go, the fewer slimes there are._";

begintalknode;
	state = 5;
	nextstate = -1;
	condition = gf(307,3) == 0;
	question = "_Why do you think that is?_";
	text1 = "She shrugs. _What do I look like? I'm an innkeeper!_ She looks pointedly at her book.";

begintalknode;
	state = 5;
	nextstate = -1;
	condition = gf(307,3) >= 1;
	question = "_We know why that is. The slime's lair was to the east._";
	text1 = "_Oh. Very interesting. Well, there have been a lot less attacks lately, so I'm glad you found it._";
	
begintalknode;
	state = 1;
	nextstate = -1;
	condition = coins_amount() >= 3;
	question = "_I need a place to sleep._ Pay 3 coins.";
	text1 = "Watching for slimes as she goes, Kelda takes you to your room. It's a dirty, ill-smelling chamber, but it seems safe.";
	action = END_TALK;	
	code =
		revive_party();
		change_coins(-3);
		relocate_char(get_pc_id(0),44,19,FALSE);
		relocate_char(get_pc_id(1),45,19,FALSE);
		relocate_char(get_pc_id(2),45,20,FALSE);
		relocate_char(get_pc_id(3),44,20,FALSE);
	break;


begintalknode;
	state = 1;
	nextstate = -1;
	condition = coins_amount() >= 1;
	question = "_I'll have a drink._ Pay a coin.";
	text1 = "You buy several glasses of thin, watered-down wine. There's no proper wine in Avernum, so even this is palatable to you.";
	code =
		force_char_status(30000,1,20);
		change_coins(-1);
	break;

begintalknode;
	state = 1;
	nextstate = -1;
	condition = 1;
	question = "_I don't need anything._";
	text1 = "_Fine. Travel safe. Keep an eye on the ground._";
	action = END_TALK;

// Vorgar

begintalknode;
	tag = 60;
	state = -1;
	nextstate = 29;
	question = "Vorgar";
	text1 = "This man's plate armor, vicious greatsword, and epic muscles mark him as one not to be trifled with. Markings on his breastplate mark him as an Empire Dervish, a member of the Empire's elite shock troops.";
	text2 = "A brief look at you raises his eyebrows. He debates what to do about you. Then he sullenly stares into his ale. _I am Vorgar,_ he grumbles.";
	text5 = "Vorgar stares into his ale. _You better have a good reason to be here._ He watches you suspiciously.";
	action = INTRO;

begintalknode;
	state = 29;
	nextstate = 30;
	question = "_Are you stationed here?_";
	text1 = "_Yeah. I have been placed here to fend off the slimes. It is one of my easier assignments._";

begintalknode;
	state = 30;
	nextstate = 31;
	question = "_So Silvar is safe, then._";
	text1 = "_While I'm here. They wanted to send two dervishes. I told them that would be overreacting. At any rate, there are few of us in Krizsan Province._";

begintalknode;
	state = 31;
	nextstate = -1;
	question = "_There don't seem to be many Empire troops in Krizsan._";
	text1 = "He grunts. _The Empire has placed little of its strength in Krizsan. I know not why, but it is not my place to question the wisdom of my benevolent masters._";

begintalknode;
	state = 30;
	nextstate = 32;
	question = "_What was one of your harder assignments?_";
	text1 = "He frowns. _I served in Avernum. I was part of a unit that was ambushed by a vahnatai and worm patrol._ (Worms were what the Empire troops called the Avernites.)";

begintalknode;
	state = 32;
	nextstate = 33;
	question = "_What happened to your unit?_";
	text1 = "_Only I and one other survived. The vahnatai even slew the wounded. I made an oath._";

begintalknode;
	state = 33;
	nextstate = -1;
	question = "_What was your oath?_";
	text1 = "_When all this business with the slimes is done, I will go back down there, alone or with others, and all you worms will pay. Count on it._ He clearly recognizes you as an Avernite. Considering the paleness of your skin, it's not too surprising.";
	action = END_TALK;

begintalknode;
	state = 29;
	nextstate = -1;
	question = "_You're an Empire dervish?_";
	text1 = "_Yeah. One of the elite. The best of the best. So you'd better leave soon if you know what's good for you. Any nephilim in this town are likely to end up impaled on a sword._";
	text3 = "_Yeah. One of the elite. The best of the best. So you'd better watch it around here. We don't like your kind._";
	code =
		if (species_in_party(2))
			remove_string(3);
			else remove_string(1);
	break;

begintalknode;
	state = 32;
	nextstate = 34;
	question = "_Worms? That is a pretty rude term._";
	text1 = "_Oh yeah?_ He stands up and puts his hand on the pommel of his sword. _Well, worms, I'm not going to stop saying it. You have a problem with that, worms?_";

begintalknode;
	state = 34;
	nextstate = -1;
	question = "_Uh, we guess not._";
	text1 = "He sits back down. _I thought not. Get out of my office, worms._";
	action = END_TALK;

begintalknode;
	state = 34;
	nextstate = -1;
	question = "_Yeah, we do. You want a fight? You got one!_";
	text1 = "_Finally! A chance for some sweet vengeance! Prepare to die, worms!_ He draws his blade. The innkeeper flees in terror.";
	action = END_TALK;
	code =
		set_attitude(12400,10);
		erase_char(12403);
	break;

// Kilborn

begintalknode;
	tag = 80;
	state = -1;
	nextstate = 57;
	question = "Kilborn";
	text1 = "This man is fastidiously cleaning, counting, stacking, and restacking several large piles of coins on the top of the altar. The coins are all shapes and sizes, and from all over.";
	text2 = "He gives you a polite little bow. _I'm Kilborn. Welcome to the Temple of the Divine Lucre._";
	text5 = "Kilborn flashes you an unctuous smile. _I'm so glad to have visitors to the Temple of the Divine Lucre._";
	action = INTRO;

begintalknode;
	state = 57;
	nextstate = 58;
	question = "_What sort of temple is this?_";
	text1 = "_Information is power. Power costs. I will tell you our philosophy for but a few coins and the services we offer for only twenty._";

begintalknode;
	state = 58;
	nextstate = -1;
	question = "_Come on, can't you tell me a little bit of your doctrine?_";
	text1 = "_I repeat, our philosophy costs five gold, and a list of services we offer costs twenty._";

begintalknode;
	state = 58;
	nextstate = 59;
	condition = coins_amount() >= 5;
	question = "_Alright, here is some money, tell me about your philosophy._ Pay 5 coins.";
	text1 = "_We believe that the making of money helps all of us. Ambition lifts the poor from the gutter, and profit is the surest path to a happy life. And in the endeavors of money-making, we lead by example._";
	code =
		change_coins(-5);
	break;

begintalknode;
	state = 59;
	nextstate = -1;
	question = "_How do you lead by example?_";
	text1 = "_It is only fitting that a priest of the faith of monetary gain would be the richest among his flock, is it not?_";

begintalknode;
	state = 58;
	nextstate = 57;
	condition = coins_amount() >= 20 && gf(124,11) == 0;
	question = "_Tell of the services you can provide._ Pay 20 coins.";
	text1 = "_Well, we no longer offer healing, I'm afraid. Not cost effective, even with the slime attacks. I do, however, have several spells I can teach very efficiently._";
	text2 = "_I can also perform the rare ritual of Added Value. If you bring me quality materials, steel, crystal, and leather, and a modest payment, I can magically turn them into superior goods._";
	code =
		change_coins(-20);
		sf(124,11,1);
	break;

begintalknode;
	state = 57;
	nextstate = -1;
	condition = gf(124,11) >= 1;
	question = "_What spells do you teach?_";
	text1 = "You conclude your business.";
	code =
		begin_shop_mode("Kilborn's Spells","Kilborn's faith teaches that money is the root of all goodness and can, in the end, buy happiness. Priests of this religion gladly sell knowledge to anyone who comes by. For a price.",42,5,3);
	break;

begintalknode;
	state = 57;
	nextstate = -1;
	question = "_Have the slimes threatened your temple recently?_";
	text1 = "_Of course. The damage they have caused have been repaired only at great expense. The health of this shrine's coffers has been seriously drained._";

begintalknode;
	state = 57;
	nextstate = 60;
	condition = gf(124,11) >= 1;
	question = "_Please perform the ritual of Added Value._";
	text1 = "He looks over your supplies. _I need fifty coins, a focusing crystal, and the finest steel or leather. Then I can transform them. Let me know what you would like._";
	
begintalknode;
	state = 60;
	nextstate = -1;
	condition = num_of_item(295) >= 1 && num_of_item(296) >= 1;
	question = "_Can you make a nice broadsword for me?_ (Give one piece of fine steel, one focusing crystal, and 50 coins.)";
	text1 = "_I could, but you don't have enough money._";
	text2 = "Kilborn takes the money and the materials. Then he casts his spell. The components liquify, merge, and form into a new item. An item with a much higher financial value.";
	text3 = "He hands you your new broadsword. _It was a pleasure doing holy business with you._";
	action = REUSABLE;
	code =	
		cs();
		if (coins_amount() < 50)
			as(1);
			else {
				as(2); as(3);
				inc_flag(309,18,1);
				change_coins(-50);
				take_num_of_item(295,1);
				take_num_of_item(296,1);
				reward_give(84);
				}
	break;
	
begintalknode;
	state = 60;
	nextstate = -1;
	condition = num_of_item(295) >= 1 && num_of_item(296) >= 1;
	question = "_Can you make a nice spear for me?_ (Give one piece of fine steel, one focusing crystal, and 50 coins.)";
	text1 = "_I could, but you don't have enough money._";
	text2 = "Kilborn takes the money and the materials. Then he casts his spell. The components liquify, merge, and form into a new item. An item with a much higher financial value.";
	text3 = "He hands you your new spear. _It was a pleasure doing holy business with you._";
	action = REUSABLE;
	code =	
		cs();
		if (coins_amount() < 50)
			as(1);
			else {
				as(2); as(3);
				inc_flag(309,18,1);
				change_coins(-50);
				take_num_of_item(295,1);
				take_num_of_item(296,1);
				reward_give(385);
				}
	break;
	
begintalknode;
	state = 60;
	nextstate = -1;
	condition = num_of_item(295) >= 1 && num_of_item(296) >= 1;
	question = "_Can you make nice greaves for me?_ (Give one piece of fine steel, one focusing crystal, and 50 coins.)";
	text1 = "_I could, but you don't have enough money._";
	text2 = "Kilborn takes the money and the materials. Then he casts his spell. The components liquify, merge, and form into a new item. An item with a much higher financial value.";
	text3 = "He hands you your new greaves. _It was a pleasure doing holy business with you._";
	action = REUSABLE;
	code =	
		cs();
		if (coins_amount() < 50)
			as(1);
			else {
				as(2); as(3);
				inc_flag(309,18,1);
				change_coins(-50);
				take_num_of_item(295,1);
				take_num_of_item(296,1);
				reward_give(353);
				}
	break;
	
begintalknode;
	state = 60;
	nextstate = -1;
	condition = num_of_item(295) >= 1 && num_of_item(294) >= 1;
	question = "_Can you make nice boots for me?_ (Give one piece of fine leather, one focusing crystal, and 50 coins.)";
	text1 = "_I could, but you don't have enough money._";
	text2 = "Kilborn takes the money and the materials. Then he casts his spell. The components liquify, merge, and form into a new item. An item with a much higher financial value.";
	text3 = "He hands you your new boots. _It was a pleasure doing holy business with you._";
	action = REUSABLE;
	code =	
		cs();
		if (coins_amount() < 50)
			as(1);
			else {
				as(2); as(3);
				inc_flag(309,18,1);
				change_coins(-50);
				take_num_of_item(294,1);
				take_num_of_item(295,1);
				reward_give(143);
				}
	break;
	
begintalknode;
	state = 60;
	nextstate = -1;
	condition = num_of_item(295) >= 1 && num_of_item(294) >= 2;
	question = "_Can you make a nice cloak for me?_ (Give two pieces of fine leather, one focusing crystal, and 50 coins.)";
	text1 = "_I could, but you don't have enough money._";
	text2 = "Kilborn takes the money and the materials. Then he casts his spell. The components liquify, merge, and form into a new item. An item with a much higher financial value.";
	text3 = "He hands you your new boots. _It was a pleasure doing holy business with you._";
	action = REUSABLE;
	code =	
		cs();
		if (coins_amount() < 50)
			as(1);
			else {
				as(2); as(3);
				inc_flag(309,18,1);
				change_coins(-50);
				take_num_of_item(294,2);
				take_num_of_item(295,1);
				reward_give(15);
				}
	break;


begintalknode;
	state = 60;
	nextstate = 57;
	condition = 1;
	question = "_I don't have any ideas._";
	text1 = "_Then I should return to my plans. Anything else?_";


begintalknode;
	state = 57;
	nextstate = -1;
	question = "_I'll be moving on._";
	text1 = "_Of course. Please return when you want to spend money. In a sacred way._";
	action = END_TALK;
